import type { UserConfig } from 'vite';
const path = require('path')

const viteConfig: UserConfig = {
    /* 端口号 */
    port: 8888,

    /* hostname */
    hostname: 'localhost',

    /* 运行自动打开浏览器 */
    open: false,

    alias: {
        '/@/': path.resolve(__dirname, './src'),
        '/@views/': path.resolve(__dirname, './src/views'),
        '/@components/': path.resolve(__dirname, './src/components'),
        '/@api/': path.resolve(__dirname, './src/api'),
        '/@utils/': path.resolve(__dirname, './src/utils'),
    },
    /* proxy */

    proxy: {
        '/api': {
            target: 'http://sit-process-saas.hogolife.com/api', // 测试
            changeOrigin: true,
            ws: true,
            rewrite: path => path.replace(/^\/api/, '')
        }
    }

};

export default viteConfig;